/***************************************************************************
 *   Copyright (C) 2008 by Eduardo Gurgel Pinho                            *
 *   edgurgel@gmail.com                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 3 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
***************************************************************************/

#ifndef __TEXTURE_MATERIAL_H__
#define __TEXTURE_MATERIAL_H__

#include "object_material.h"
#include "common/tga.h"
#include "common/image.h"
#include "common/color.h"

#include <boost/serialization/nvp.hpp>

namespace Sirat {

namespace Material {

class Texture_Material : public Object_Material {
public:
	Texture_Material(Common::Image* const _texture,const Common::Color& _reflectiveness);
	Texture_Material();	
	Texture_Material(const Texture_Material& _texture_material);
	~Texture_Material();
	
	Common::Color get_texel(const double _u, const double _v) const;
	
	Common::Color get_reflectiveness() const;
	
	void set_reflectiveness(const Common::Color& _reflectiveness);
	
	Texture_Material& operator=(const Texture_Material& _texture_material);

	Material* clone() { return new Texture_Material(*this); }
	
private:
	friend class boost::serialization::access;
	template<class Archive> void serialize(Archive&, const unsigned int);
	
	Common::Image* texture;
	Common::Color reflectiveness;

};

template<class Archive> void Texture_Material::serialize(Archive& ar, const unsigned int /* file_version */){
	ar  & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Object_Material)
		& BOOST_SERIALIZATION_NVP(texture);
}

}

}

#endif
